<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\searchs\UserLogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '申请记录';
$this->params['breadcrumbs'][] = $this->title;
$this->registerCssFile('@web/css/user_log.css');
?>
<div class="user-log-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?/*= Html::a('Create User Log', ['create'], ['class' => 'btn btn-success']) */?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
     //   'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'label'=>'申请人',
                'value'=>function($data){
                    return $data->person->name;
                },
            ],
            [
                'label'=>'类型',
                'value'=>function($data){
                    if($data->type == 1){
                        return "公司负责人申请";
                    }
                    else if($data->type == 2){
                        return  "园区负责人申请";
                    }
                },
            ],
            [
                'label'=>'申请公司',
                'value'=>function($data){
                    if($company = $data->company)
                        return $company->name;
                },
            ],
            [
                'label'=>'申请园区',
                'value'=>function($data){
                    if($park = $data->park)
                        return $park->name;
                },
            ],



            [
                'label'=>'申请时间',
                'value'=>function($data) {
                    return date("Y-m-d H:i:s",$data->date);
                },
            ],

            [
                'label'=>'当前状态',
                'format' => 'raw',
                'value'=>function($data) {
                    if ($data->status == 1) {
                        return "<span class='waiting'>等待审核</span>";
                    } else if ($data->status == 2) {
                        return "<span class='deny'>审核未通过</span>";
                    } else if ($data->status == 3) {
                        return "<span class='pass'>审核通过</span>";
                    }
                },
            ],

          //  'id',
         //   'idcard_img',
         //   'cachet_img',
            // 'date',
            //  'status',


            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
